﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Roton.ZZT
{
    interface IDisplay
    {
        /// <summary>
        /// Display a prompt asking for the user to either press Y (true) or N (false). ESC is also false.
        /// </summary>
        /// <param name="text">Text to show.</param>
        /// <param name="defaultChoice">Default choice.</param>
        /// <returns>Prompt result.</returns>
        bool AskYN(ByteString text, bool defaultChoice);

        /// <summary>
        /// Draw the onscreen flashing message.
        /// </summary>
        /// <param name="text">Text to draw.</param>
        /// <param name="color">Color to draw the text.</param>
        void DrawMessage(ByteString text, int color);

        /// <summary>
        /// Fade the display out, then fade the currently set board in.
        /// </summary>
        void Fade();

        /// <summary>
        /// Generates the matrix of tiles for the display.
        /// </summary>
        void GenerateFadeMatrix();

        /// <summary>
        /// Redraws the board on the display.
        /// </summary>
        void RedrawBoard();

        /// <summary>
        /// Renders the entire HUD.
        /// </summary>
        void RedrawStatus();

        /// <summary>
        /// Present the player with a 2-option choice.
        /// </summary>
        /// <param name="y">Y location to show the choice.</param>
        /// <returns></returns>
        bool SelectBoolean(int y);

        /// <summary>
        /// Present the player with a 9-option choice. (0-8)
        /// </summary>
        /// <param name="y">Y location to show the choice.</param>
        /// <returns></returns>
        int SelectValue(int y);

        /// <summary>
        /// Set the displayed message.
        /// </summary>
        /// <param name="duration">Number of ticks to display the message for.</param>
        /// <param name="message">Message to display.</param>
        void SetMessage(int duration, ByteString message);

        /// <summary>
        /// Load help file and display it.
        /// </summary>
        /// <param name="message">Contents of the help file.</param>
        /// <param name="name">Name of the help file.</param>
        void ShowHelp(ByteString message, ByteString name);

        /// <summary>
        /// Show a scroll.
        /// </summary>
        /// <param name="message">Contents of the scroll.</param>
        /// <param name="name">Name of the scroll.</param>
        void ShowScroll(ByteString message, ByteString name);

        /// <summary>
        /// Ask the player for short text entry. Used for entering cheats and saving worlds.
        /// </summary>
        /// <param name="message">Message to show.</param>
        /// <param name="defaultText">Default text.</param>
        /// <returns></returns>
        ByteString TextEntry(ByteString message, ByteString defaultText);

        /// <summary>
        /// Ask the player for long text entry. Used for entering board names and high scores.
        /// </summary>
        /// <param name="message">Message to show.</param>
        /// <param name="defaultText">Default text.</param>
        /// <returns></returns>
        ByteString TextEntryLong(ByteString message, ByteString defaultText);

        /// <summary>
        /// Update a tile in the display.
        /// </summary>
        /// <param name="x">X location to update.</param>
        /// <param name="y">Y location to update.</param>
        void UpdateBoardAt(int x, int y);

        /// <summary>
        /// Update the border, typically to remove a displayed message.
        /// </summary>
        void UpdateBorder();

        /// <summary>
        /// Update the status bar's displayed values.
        /// </summary>
        void UpdateStatus();
    }
}
